//
//  UIImageView+Extension.m
//  ICome
//
//  Created by zhangrongwu on 16/4/11.
//  Copyright © 2016年 iCom. All rights reserved.
//

#import "UIImageView+Extension.h"
#import "ICHeaderFile.h"
@implementation UIImageView (Extension)

- (instancetype)initWithSize:(CGSize)imageSize imageName:(NSString *)imageName {
    if (self = [super init]) {
        CALayer *avatarBorder = [CALayer layer];
        avatarBorder.frame = CGRectMake(0, 0, imageSize.width, imageSize.height);
        avatarBorder.borderWidth = 2;
        avatarBorder.borderColor =  ICRGB(0xe3e3e3).CGColor;
        avatarBorder.cornerRadius = imageSize.width / 2;
        avatarBorder.shouldRasterize = YES;
        [self.layer addSublayer:avatarBorder];
        
        if (imageName) {
            self.image = [UIImage imageNamedFromiComeSDKBundle:imageName];
        }
        self.userInteractionEnabled = YES;
    }
    return self;
}

//+(void)load {
//    [self swizzleInstanceMethod:[self class] originSelector:@selector(sd_setImageWithURL:placeholderImage:) otherSelector:@selector(wr_setImageWithURL:placeholderImage:)];
//}
//
//- (void)wr_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder {
//    BOOL isExit = [[SDWebImageManager sharedManager] cachedImageExistsForURL:url];
//    if (isExit) {
//        [self wr_setImageWithURL:url placeholderImage:placeholder];
//    } else  {
//        [self wr_setImageWithURL:nil placeholderImage:placeholder];
//    }
//}






@end
